package com.cm.study.springboot.zk.client.zk;

import org.apache.zookeeper.data.Stat;

public class ZkClient {
    public static void main(String[] args) throws Exception {
        ZooKeepers zooKeepers = ZooKeepers.getInstants();
        zooKeepers.create("/aaa","aaa".getBytes());
        Stat aaaStat = zooKeepers.exists("/aaa", true);
        if (aaaStat !=null) {
            zooKeepers.delete("/aaa",aaaStat.getVersion());
        }
        //zooKeepers.create("/aa/bb/cc","ee".getBytes());

        //List<String> children = zooKeepers.getChildren("/aa", false);
        //System.out.println(children);
        //zooKeepers.setData("/aa","aa".getBytes(),0);

        //String[] tree = zooKeepers.getTree("/aa");
        //System.out.println("tree = " + tree);

        //zooKeepers.delete("/aa",0);

        /*Stat exists = zooKeepers.exists("/aa", false);
        System.out.println("exists = " + exists);
        if(exists !=null){
            zooKeepers.delete("/aa",exists.getVersion());
        }*/
    }
}
